define(function (require, exports, module) {
	var Grid = require("grid");
	
    var instance = {
        initComponent: function (params,widget) {
        	var subGrid = new Grid({
                parentNode: ".J-subGrid", 
                model : {
                	id:"subGrid",
                    columns : [{
                    	name:"cardNo",
        				label:"编号"
        			},{
						name:"returnNumber",
						label:"充值次数"
					},{
						name:"returnTotal",
						label:"充值总金额（元）",
						format:function(value, row){
							if(value){
								return value.toFixed(2);
							}else{
								return ""
							}
						}
					},{
        				name:"consumptionTotal",
        				label:"消费金额（元）",
        				format:function(value,row){
        					if(value){
								return value.toFixed(2);
							}else{
								return ""
							}
        				}
					},{						
						name:"cashTotal",
        				label:"取现金额（元）",
        				format: function(value,row){
        					if(value){
								return value.toFixed(2);
							}else{
								return ""
							}
        				}
					},{
        				name:"balance",
        				label:"余额（元）",
        				format: function(value,row){
        					if(value){
								return value.toFixed(2);
							}else{
								return ""
							}
        				}
        			}]
                }
            });
        	$(".J-subGrid").find(".box-content").before($("<div></div>").addClass("box-header")
					.append($("<div></div>").addClass("title").text("消费券")));
            widget.set("subGrid",subGrid);
        }
    };
    module.exports = instance;
});